package com.jcp.dao;

import java.util.List;

import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;


import com.jcp.entity.Stats;

import tk.mybatis.mapper.common.Mapper;

/**
 * 
 * @author Administrator
 *
 */
@Repository
public interface StatsMapper extends Mapper<Stats> {
	
	@Select("select DATE_FORMAT(enter_time,'%Y-%m-%d') days,count(recordId) count from Record  \r\n" + 
			"where DATE_SUB(CURDATE(), INTERVAL 7 DAY) < date(enter_time) \r\n" + 
			"and date(enter_time)<=DATE_SUB(CURDATE(),INTERVAL 0 DAY) group by days;")
	public List<Stats> selectRecord();

	@Select("select DATE_FORMAT(out_time,'%Y-%m-%d') days,count(recordId) count from Record  \r\n" + 
			"where DATE_SUB(CURDATE(), INTERVAL 7 DAY) < date(out_time) \r\n" + 
			"and date(out_time)<=DATE_SUB(CURDATE(),INTERVAL 0 DAY) group by days;")
	public List<Stats> selectRecordOut();
	
	@Select("select DATE_FORMAT(payTime,'%Y-%m-%d') days,sum(payment_amount) count from Parment  \r\n" + 
			"where DATE_SUB(CURDATE(), INTERVAL 7 DAY) < date(payTime)  \r\n" + 
			"and date(payTime)<=DATE_SUB(CURDATE(),INTERVAL 0 DAY) group by days;")
	public List<Stats> selectParment();
}
